/**
 * 
 */
package common;


import java.awt.Font;
import java.io.InputStream;
import java.net.URL;

/**
 *Creates a font and returns it
 *
 */
public class FontFactory {
	
	//the font we want to use
	private static String fontName = "Herculanum.ttf";
	
	/**
	 * creates the font we want to use and returns in
	 */
	public Font createFont(int size){
		URL url = this.getClass().getResource("/graphics/"+fontName);
		InputStream in = this.getClass().getResourceAsStream("/graphics/"+fontName);
		Font font = null;
	    try{
		font = Font.createFont(Font.TRUETYPE_FONT, in);
	    } catch (Exception ex) {
	      ex.printStackTrace();
	      System.err.println(fontName + " not loaded.  Using serif font.");
	      font = new Font("serif", Font.PLAIN, size);
	    }
	    Font resizedFont = font.deriveFont((float)size);
		return resizedFont;
	}
	
	public Font createFont(){
		return createFont(24);
	}
	

}
